
"""Pypione

That is, PyPi on the Engine.  Or, a Python Package Index mirror on Google App Engine.

The Package Index HTTP interface: http://peak.telecommunity.com/DevCenter/EasyInstall#package-index-api
Pypione project page: http://code.google.com/p/pypione
PyPi site: http://pypi.appspot.com/
 
"""
import wsgiref.handlers
from google.appengine.ext import webapp
from pypione.handlers import *

log = logging.getLogger()

application = webapp.WSGIApplication(
    [(r'/p/upload/?',                                  Upload),
     (r'/p/fetch/([^/]+)/?([^/]*)/?',                  Fetch),
     (r'/p/queue/fetch-later/r/([^/]+)/?([^/]*)/?',    QueueFetchLater),
     (r'/p/queue/fetch-in-chunks/r/([^/]+)/([^/]+)/([^/]+)/?([^/]*)/?',    QueueFetchInChunks),
     (r'/p/queue/fix-packages/r/([^/]+)/?',            QueueFixPackages),
     (r'/p/queue/fix-packages/pending/?',              QueueFixPackagesPending),
     (r'/p/queue/([^/]+)/pending/?',                   QueuePending),
     (r'/p/queue/admin/?',                             QueueAdmin),
     (r'/([^/]+)/file/(.*)',                           Download),
     (r'/([^/]+)/?([^/]*)/?',                          ShowPackage),
     (r'/',                                            Index)], 
        debug=True)
         
def main():
    wsgiref.handlers.CGIHandler().run(application)

if __name__ == "__main__":
    main()